using UnityEngine;
using System.Collections.Generic;
using Framework.Save;
using LitJson;

namespace GameCore
{
    public abstract class Region : ManagedPrefab, IJsonSerializable
    {
        private ObjectData data = new();
        public override void ResetData() => data = new();
        public override void SetData(GameData data) => this.data = data as ObjectData;
        public void SetData(string key, GameData value) => data[key] = value;
        public bool HasData(string key) => data.ContainsKey(key);
        public override GameData GetData() => data;
        public GameData GetData(string key) => data[key];

        public abstract JsonData Serialize();
        public abstract void Deserialize(JsonData data);
    }
}